#include <iostream>
using namespace std;

class Solution1
{
  public:
    bool isPowerOfTwo(int n)
    {
        if (n <= 0)
            return false;
        while (n != 1)
        {
            if (n % 2 != 0)
                return false;
            n /= 2;
        }
        return true;
    }
};

class Solution
{
  public:
    bool isPowerOfTwo(int n)
    {
        if (n <= 0)
            return false;
        return ((n & (n - 1)) == 0);
    }
};

int main()
{
    int num = 6;
    cout << Solution().isPowerOfTwo(num) << endl;
    return 0;
}
